import { createRouter, createWebHistory } from 'vue-router';
import Home from '../views/Home.vue';
import AdminHome from '../views/AdminHome.vue';
import Users from '../views/Users.vue';
import Login from '../views/auth/Login.vue';
import Layout from '../views/Layout.vue';
import AIQuestion from '../views/AIQuestion.vue';
import ChangePassword from '@/views/personal/ChangePassword.vue';
import AdminTime from '@/views/AdminTime.vue';

const routes = [
  { path: '/', redirect: '/login' },
  {
    path: '/',
    component: Layout,
    children: [
      { path: 'home', component: Home },
      { path: 'ai-question', component: AIQuestion },
      { path: 'intelligent-408-qna', component: () => import('../views/Intelligent408Qna.vue') },
      { path: 'intelligent-408-search', component: () => import('../views/Intelligent408Search.vue') },
      { path: 'personalized-exercises', component: () => import('../views/PersonalizedExercises.vue') },
      { path: 'error-book', component: () => import('../views/ErrorBook.vue') },
      { path: 'clock', component: () => import('../views/clock/Clock.vue') },
      { path: 'personal/ChangePassword', component: ChangePassword },
    ],
  },
  { path: '/AdminHome', component: AdminHome }, // 管理员主页独立路由
  { path: '/admin/users', component: Users },
  { path: '/admin/time', component: AdminTime }, // 新增：时间管理
  { path: '/login', component: Login }
 

];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;